package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentOption;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 查询员工职位数据
     * @return
     */
    @GetMapping("empJobData")
    public Result empJobData(){
        log.info("查询员工职位数据");
       JobOption jobOption = reportService.empJobData();
        return Result.success(jobOption);
    }
    /**
     * 查询员工性别数据
     * @return
     */
    @GetMapping("empGenderData")
    public Result empGenderData(){
        log.info("查询员工性别数据");
        List<Map<String,Object>> genderList = reportService.getEmpGenderData();
        return Result.success(genderList);
    }
    /**
     * 统计学生的学历信息
     * @return
     */
    @GetMapping("studentDegreeData")
    public Result studentDegreeData(){
        log.info("统计 colleges 表中每个部门的学历信息");
        List<Map<String,Object>> degreeList = reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }
    /**
     * 统计班级人数
     * @return
     */
    @GetMapping("studentCountData")
    public Result studentCountData(){
        log.info("统计班级人数");
         StudentOption studentOption = reportService.getStudentCountData();
        return Result.success(studentOption);
    }
}
